package com.lbt.javaSE.Alog;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class ArrayListTest {
    public static void main(String[] args) {
        ArrayList<Integer> list=new ArrayList<Integer>(Arrays.asList(1,2,3,4,5));
        int size1 = list.size();
        System.out.println("size1:"+size1);
        list.remove(0);
        int size2 = list.size();
        System.out.println("size2:"+size2);
        list.set(0,100);
        System.out.println(list.get(0));
        System.out.println("=======================");
        //ArrayList  遍历
        //ArrayList  迭代器
        Iterator<Integer> iterator = list.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());

        }
        //二、增强for 循环
        System.out.println("/////////////////");
        for( int bs:list){
            System.out.println(bs);
        }
        //三 遍历
        System.out.println("*****************");
        for( int i=0;i<list.size();i++){
            System.out.println(list.get(i));
        }
    }
}
